#include<gflags/gflags.h>
#include"../Common/etcd.hpp"

DEFINE_bool(log_mod,false,"true为发布模式,false为调试模式");
DEFINE_string(log_file,"","发布模式下日志存储的文件");
DEFINE_int32(log_level,0,"要输出的日志等级");
int main(int argc,char* argv[])
{
    google::ParseCommandLineFlags(&argc,&argv,true);
    init_logger(FLAGS_log_mod,FLAGS_log_file,(spdlog::level::level_enum)FLAGS_log_level);
    const std::string etcd_host = "http://127.0.0.1:2379";//客户端注册中心地址
    const std::string basedir = "/service";//查询的根目录
    const std::string instance_name = "/user3/instance";//一个实例名称
    const std::string instance_host ="/127.0.0.1:8088";//这个实力的服务外部访问地址
    std::shared_ptr<Registery> registery = std::make_shared<Registery>(etcd_host);
    registery->Register(basedir+instance_name+"1",instance_host);
    registery->Register(basedir+instance_name+"2",instance_host);
    registery->Register(basedir+instance_name+"3",instance_host);
    std::this_thread::sleep_for(chrono::minutes(10));

}